package com.liu.design.behavior.chain.servlet;

/**
 * @author LIU
 * @version 1.0
 * @description: 责任链模式
 * @date 2022/12/20 14:29
 */
public class _Test {
    public static void main(String[] args) {
        FilterChain chain = new FilterChain();

        // 过滤器链
        chain.addFilter(new HttpFilter());
        chain.addFilter(new CharacterFilter());
        chain.addFilter(new EncodingFilter());

        // 目标程序
        chain.setTarget(new Target());

        // 执行调用链
        chain.doFilter(new Request("request msg")
                , new Response("response msg")
                , chain);
    }
}
